c733cbec38e6773e90b233f3468825dbc453f719,src/test/java/com/metamx/http/client/FriendlyServersTest.java,FriendlyServersTest,testFriendlySelfSignedHttpsServer,#,88

Before Change


      try {
        trustingClient
            .get(new URL(String.format("https://127.0.0.1:%d/", sslConnector.getLocalPort())))
            .go(new StatusResponseHandler(Charsets.UTF_8));
      }
      catch (ChannelException e1) {
        ea = e1;

After Change


      Assert.assertEquals(404, status.getCode());

      // Incorrect name ("127.0.0.1")
      final ListenableFuture<StatusResponseHolder> response1 = trustingClient
          .get(new URL(String.format("https://127.0.0.1:%d/", sslConnector.getLocalPort())))
          .go(new StatusResponseHandler(Charsets.UTF_8));

      Throwable ea = null;
      try {
        response1.get();
      }
      catch (ExecutionException e) {
        ea = e.getCause();
      }

      Assert.assertTrue("ChannelException thrown by 'get'", ea instanceof ChannelException);
      Assert.assertTrue("Expected error message", ea.getCause().getMessage().matches(".*Failed to handshake.*"));

      // Untrusting client
      final ListenableFuture<StatusResponseHolder> response2 = skepticalClient
          .get(new URL(String.format("https://localhost:%d/", sslConnector.getLocalPort())))
          .go(new StatusResponseHandler(Charsets.UTF_8));

      Throwable eb = null;
      try {
        response1.get();
      }
      catch (ExecutionException e) {
        eb = e.getCause();